package ru.amse.tsyganov.jumleditor.editor;

import ru.amse.tsyganov.jumleditor.model.ActivityGraph;
import ru.amse.tsyganov.jumleditor.model.State;
import ru.amse.tsyganov.jumleditor.view.ActivityGraphView;
import ru.amse.tsyganov.jumleditor.view.StateView;

public class EditorUtil {
	
	public static StateView<? extends State> getControl(
			ActivityGraphView<ActivityGraph> activityGraphView, 
			int x, int y) {
		
		for (StateView<? extends State> stateView : 
			activityGraphView.getPartitions().get(0).getContents()) {
			if (stateView.getRectangle().contains(x, y)) {
				return stateView;
			}
		}
		return null;
	}
}
